/* Wrapper
------------------------------ */
$block: '.aui-wrapper';
#{$block} {
  position: relative;
  min-height: 100vh;
  padding-top: $header--height;
  overflow: hidden;
}
#{$block}--full {
  padding-top: 0;
}


/* Header
------------------------------ */
$block: '.aui-header';
#{$block} {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: $header--zindex;
  height: $header--height;
  box-shadow: $header--shadow;
  &__hd {
    position: absolute;
    top: 0;
    left: 0;
    width: $aside--width;
    height: $header--height;
    background-color: $color--primary;
    transition: width .3s;
  }
  .aui-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    width: $aside--width;
    height: 100%;
    padding: 5px;
    margin: 0;
    text-transform: uppercase;
    white-space: nowrap;
    color: $color--white;
    overflow: hidden;
    cursor: pointer;
    transition: width .3s;
  }
  .aui-brand--sm {
    display: none;
  }
  &__bd {
    position: relative;
    display: flex;
    margin-left: $aside--width;
    background-color: $color--white;
    transition: margin-left .3s;
  }
  &__menu.el-menu {
    background-color: transparent;
    border-bottom: 0 !important;
  }
  &__menu.el-menu .el-submenu {
    position: relative;
  }
  &__menu.el-menu > .el-menu-item,
  &__menu.el-menu > .el-submenu > .el-submenu__title {
    height: $header--height;
    padding: 0 15px;
    line-height: $header--height;
  }
  &__menu.el-menu .el-menu-item,
  &__menu.el-menu .el-menu-item.is-active,
  &__menu.el-menu .el-submenu .el-submenu__title,
  &__menu.el-menu .el-submenu.is-active .el-submenu__title,
  &__menu.el-menu .el-submenu:focus .el-submenu__title {
    border-bottom: 0 !important;
    color: $color--text-regular;
    transition: none;
    &:hover {
      color: $color--primary;
    }
  }
  &__menu.el-menu .el-submenu > .el-menu--horizontal {
    min-width: calc(100% - (5px * 2));
    margin: 0 5px;
  }
  &__menu.el-menu .el-submenu > .el-menu--horizontal .el-menu,
  &__menu.el-menu .el-submenu > .el-menu--horizontal .el-menu-item {
    min-width: 100%;
  }
  &__menu.el-menu .el-submenu > .el-menu--horizontal .el-menu {
    margin-right: 0;
    margin-left: 0;
  }
  &__menu.el-menu > .el-menu-item > a,
  &__menu.el-menu > .el-submenu .el-submenu__title > a {
    display: inline-block;
    font-size: 16px;
  }
  &__menu.el-menu .el-menu-item *,
  &__menu.el-menu .el-submenu .el-submenu__title * {
    vertical-align: initial;
  }
  &__menu.el-menu .el-menu-item i,
  &__menu.el-menu .el-submenu .el-submenu__title i {
    display: inline-block;
    vertical-align: middle;
    color: inherit;
  }
  &__menu.el-menu .el-submenu .el-menu--horizontal {
    position: absolute !important;
  }
  &__menu.el-menu > .el-submenu.not-arrow > .el-submenu__title > .el-submenu__icon-arrow {
    display: none;
  }
  &__menu.el-menu &__icon-menu {
    font-size: 16px;
    vertical-align: middle;
  }
  .aui-search {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1;
    height: 0;
    background-color: $color--white;
    overflow: hidden;
    transition: height .3s;
  }
  .aui-search__inner {
    height: 100%;
    padding: 5px 15px;
  }
  .aui-search__input,
  .aui-search__input .el-input__inner {
    height: 100%;
    background-color: transparent;
  }
  .aui-search__input .el-input-group__prepend {
    font-size: $font--size-xl;
    background-color: transparent;
  }
  .aui-search--show {
    height: 100%;
  }
  .aui-avatar {
    width: $header--height - 12px;
    height: auto;
    margin-right: 5px;
    border-radius: 100%;
    vertical-align: middle !important;
  }
  &__menu--right {
    margin-left: auto;
  }
  &__menu--right.el-menu .el-submenu > .el-menu--horizontal {
    right: 0 !important;
    left: initial !important;
  }
  &__menu--right.el-menu .el-submenu > .el-menu--horizontal .el-menu--horizontal {
    right: 100% !important;
    left: initial !important;
  }
}
#{$block}--colorful {
  #{$block} {
    box-shadow: none;
  }
  #{$block}__bd,
  #{$block}__menu.el-menu .el-menu,
  #{$block}__menu.el-menu .el-menu-item,
  #{$block}__menu.el-menu .el-submenu .el-submenu__title {
    background-color: $color--primary;
  }
  #{$block}__menu.el-menu .el-menu-item,
  #{$block}__menu.el-menu .el-menu-item.is-active,
  #{$block}__menu.el-menu .el-submenu .el-submenu__title,
  #{$block}__menu.el-menu .el-submenu.is-active .el-submenu__title,
  #{$block}__menu.el-menu .el-submenu:focus .el-submenu__title {
    color: $color--white;
    &:focus {
      background-color: transparent;
    }
    &:hover {
      color: $color--white;
      background-color: mix($color--black, $color--primary, 15%);
    }
  }
  #{$block}__menu.el-menu > .el-menu-item > .el-button,
  #{$block}__menu.el-menu > .el-submenu > .el-submenu__title > .el-button {
    color: $color--white;
    border-color: $color--white;
    background-color: transparent;
  }
  .aui-search {
    background-color: $color--primary;
  }
  .aui-search__input .el-input-group__prepend,
  .aui-search__input .el-input__inner {
    color: $color--white;
    border-color: $color--white;
  }
  .aui-search__input .el-input__inner {
    &::-webkit-input-placeholder {
      color: mix($color--white, $color--primary, 50%);
    }
  }
  .aui-search__input .el-input__suffix i {
    color: $color--white;
  }
}
#{$block}--fixed {
  #{$block} {
    position: fixed;
  }
}


/* Aside
------------------------------ */
$block: '.aui-aside';
#{$block} {
  position: absolute;
  top: $header--height;
  bottom: 0;
  left: 0;
  z-index: $aside--zindex;
  width: $aside--width;
  box-shadow: $aside--shadow;
  background-color: $color--white;
  overflow: hidden;
  transition: width .3s;
  &__inner {
    position: relative;
    z-index: 1;
    width: $aside--width + 20px;
    height: 100%;
    padding-bottom: 15px;
    overflow-x: hidden;
    overflow-y: scroll;
    transition: width .3s;
  }
  &__menu.el-menu {
    width: $aside--width;
    border-right: 0;
    transition: width .3s;
  }
  &__menu.el-menu .el-menu-item,
  &__menu.el-menu .el-submenu .el-submenu__title {
    height: $aside--menu-item-height;
    line-height: $aside--menu-item-height;
    color: $color--text-regular;
    &:hover {
      color: $color--primary;
      background-color: transparent;
    }
  }
  &__menu.el-menu .el-menu-item.is-active,
  &__menu.el-menu .el-submenu.is-active,
  &__menu.el-menu .el-submenu.is-active .el-menu,
  &__menu.el-menu .el-submenu.is-opened,
  &__menu.el-menu .el-submenu.is-opened .el-menu {
    background-color: $color--primary-light-9;
  }
  &__menu.el-menu .el-menu-item.is-active,
  &__menu.el-menu .el-submenu.is-active > .el-submenu__title,
  &__menu.el-menu > .el-submenu.is-opened > .el-submenu__title {
    color: $color--primary;
  }
  &__menu.el-menu .el-menu-item i,
  &__menu.el-menu .el-submenu .el-submenu__title i {
    color: inherit;
  }
  &__menu.el-menu .el-submenu .el-menu--vertical {
    position: fixed !important;
  }
  &__menu.el-menu .el-submenu__icon-arrow {
    margin-top: -6px;
  }
  &__menu-icon {
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    margin-right: 5px;
    text-align: center;
    font-size: 16px;
    color: inherit;
    transition: font-size .3s;
  }
}
#{$block}--dark {
  #{$block} {
    box-shadow: none;
  }
  #{$block},
  #{$block}__menu.el-menu,
  #{$block}__menu.el-menu .el-menu {
    background-color: $aside--background-color-dark;
  }
  #{$block}__menu.el-menu .el-menu-item,
  #{$block}__menu.el-menu .el-submenu .el-submenu__title {
    color: $aside--text-color-dark;
    &:hover {
      color: $color--white;
    }
  }
  #{$block}__menu.el-menu .el-menu-item.is-active,
  #{$block}__menu.el-menu .el-submenu.is-active,
  #{$block}__menu.el-menu .el-submenu.is-active .el-menu,
  #{$block}__menu.el-menu .el-submenu.is-opened,
  #{$block}__menu.el-menu .el-submenu.is-opened .el-menu {
    background-color: mix($color--white, $aside--background-color-dark, 5%);
  }
  #{$block}__menu.el-menu .el-menu-item.is-active,
  #{$block}__menu.el-menu .el-submenu.is-active > .el-submenu__title,
  #{$block}__menu.el-menu > .el-submenu.is-opened > .el-submenu__title {
    color: $color--white;
  }
}
#{$block}--fixed {
  .aui-header__hd,
  #{$block} {
    position: fixed;
  }
}
#{$block}--fold {
  .aui-header__hd,
  .aui-header .aui-brand {
    width: $aside--width-fold;
  }
  .aui-header .aui-brand--lg {
    display: none;
  }
  .aui-header .aui-brand--sm {
    display: flex;
  }
  .aui-header__bd {
    margin-left: $aside--width-fold;
  }
  .aui-header__icon-menu--rz180 {
    transform: rotateZ(180deg);
  }
  #{$block},
  #{$block}__menu.el-menu {
    width: $aside--width-fold;
  }
  #{$block}__inner {
    width: $aside--width-fold + 20px;
  }
  #{$block}__menu.el-menu > .el-menu-item > #{$block}__menu-icon,
  #{$block}__menu.el-menu > .el-menu-item > .el-tooltip > #{$block}__menu-icon,
  #{$block}__menu.el-menu > .el-submenu > .el-submenu__title > #{$block}__menu-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: 0;
    font-size: 18px;
    transform: translate(-50%, -50%);
  }
  .aui-main {
    margin-left: $aside--width-fold;
  }
  .aui-footer {
    margin-left: $aside--width-fold;
  }
}


/* Aside-control
------------------------------ */
$block: '.aui-aside-control';
#{$block} {
  position: absolute;
  top: $header--height;
  right: -$aside-control--width;
  bottom: 0;
  z-index: $aside-control--zindex;
  width: $aside-control--width;
  background-color: $color--white;
  transition: right .3s;
  &__toggle {
    position: absolute;
    top: 80px;
    left: -40px;
    width: 40px;
    padding: 12px 8px;
    font-size: 20px;
    text-align: center;
    line-height: 1;
    border-radius: $border--radius-base 0 0 $border--radius-base;
    color: $color--white;
    background-color: $color--primary;
    cursor: pointer;
  }
  &__inner {
    position: relative;
    z-index: 1;
    width: $aside-control--width + 20px;
    height: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
  }
  &__bd {
    width: $aside-control--width;
    padding: 5px 20px 20px;
  }
  .aui-tabs.el-tabs {
    margin: -5px -20px -20px;
  }
  .aui-tabs.el-tabs .el-tabs__content {
    padding: 0 15px 15px;
  }
  &__setting {
    margin: 0;
  }
  &__setting > dt {
    margin-top: 15px;
    font-size: $font--size-xl;
    font-weight: 900;
  }
  &__setting > dd {
    margin-top: 10px;
    margin-left: 1em;
  }
  &__setting + &__setting {
    margin-top: 15px;
    border-top: 1px solid $border--color-lighter;
  }
}
#{$block}--fixed {
  #{$block} {
    position: fixed;
  }
  &#{$block}--open .aui-main {
    margin-right: 0;
  }
  &#{$block}--open .aui-footer {
    margin-right: 0;
  }
}
#{$block}--open {
  #{$block} {
    right: 0;
    box-shadow: $aside-control--shadow;
  }
  .aui-main {
    margin-right: $aside-control--width;
  }
  .aui-footer {
    margin-right: $aside-control--width;
  }
}


/* Main
------------------------------ */
$block: '.aui-main';
#{$block} {
  position: relative;
  min-height: calc(100vh - #{$header--height} - #{$footer--height});
  margin-left: $aside--width;
  background-color: $main--background-color;
  transition: margin-right .3s, margin-left .3s;
  &__hd {
    padding: 15px;
    background-color: $color--white;
    box-shadow: $main--tabs-header-shadow;
  }
  &__bd {
    padding: 15px;
  }
  &-tabs__tool {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: $main--tabs-tool-width;
    height: $main--tabs-header-height;
    text-align: center;
    line-height: $main--tabs-header-height;
    background-color: $bg--color-base;
    cursor: pointer;
    transition: right .3s;
  }
  &-tabs.el-tabs {
    padding-top: $main--tabs-header-height;
  }
  &-tabs.el-tabs > .el-tabs__header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    padding: 0 ($main--tabs-tool-width + 15px) 0 15px;
    box-shadow: $main--tabs-header-shadow;
    background-color: $color--white;
    transition: right .3s, left .3s;
  }
  &-tabs.el-tabs > .el-tabs__header > .el-tabs__nav-wrap  {
    &::after {
      display: none;
    }
  }
  &-tabs.el-tabs > .el-tabs__header > .el-tabs__nav-wrap > .el-tabs__nav-scroll > .el-tabs__nav > .el-tabs__item {
    height: $main--tabs-header-height;
    line-height: $main--tabs-header-height;
    color: $color--text-regular;
  }
  &-tabs.el-tabs > .el-tabs__content {
    padding: $main--tabs-content-padding-y $main--tabs-content-padding-x;
  }
  &-tabs.el-tabs > .el-tabs__content > .el-tab-pane {
    min-height: calc(100vh - #{$header--height} - #{$main--tabs-header-height} - (#{$main--tabs-content-padding-y} * 2) - #{$footer--height}); 
    padding: $main--tabs-panel-padding-y $main--tabs-panel-padding-x;
    border: 1px solid $border--color-lighter;
    border-radius: $border--radius-base;
    background-color: $color--white;
  }
  &-tabs.el-tabs > .el-tabs__content > .aui-main-tabs__pane--full.el-tab-pane {
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background-color: transparent;
  }
  
}
#{$block}-tabs__header--fixed {
  #{$block}-tabs__tool {
    position: fixed;
    top: $header--height;
  }
  #{$block}-tabs.el-tabs > .el-tabs__header {
    position: fixed;
    top: $header--height;
    left: $aside--width;
  }
  &.aui-aside--fold #{$block}-tabs.el-tabs > .el-tabs__header {
    left: $aside--width-fold;
  }
  &.aui-aside-control--open #{$block}-tabs__tool,
  &.aui-aside-control--open #{$block}-tabs.el-tabs > .el-tabs__header  {
    right: $aside-control--width;
  }
}


/* Footer
------------------------------ */
$block: '.aui-footer';
#{$block} {
  position: relative;
  height: $footer--height;
  padding:  $footer--padding-y $footer--padding-x;
  margin-left: $aside--width;
  text-align: center;
  box-shadow: $footer--shadow;
  color: $color--text-secondary;
  transition: margin-right .3s, margin-left .3s;
  p {
    margin: 10px 0;
  }
  a {
    padding: 0 5px;
  }
}
